Skip to content

Implement water_heater platform - part 2#1092

Draft
bouwew wants to merge 31 commits into
mainfrom
water_heater_2
Draft

Implement water_heater platform - part 2#1092
bouwew wants to merge 31 commits into
mainfrom
water_heater_2

Conversation

@bouwew

@bouwew bouwew commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added separate water heater entities for independent boiler temperature and DHW temperature control (with separate setpoints).
  • Changes

    • DHW mode default changed from “off” to “eco”, and “off” was removed from the DHW mode selector.
    • Removed maximum boiler/DHW temperature number entities; remaining temperature controls now align to the new boiler/DHW setpoints.
    • Updated water heater readings, operation behavior, and UI translations to match the split entities.
  • Chores

    • Updated the Plugwise library dependency and refreshed related tests/fixtures/snapshots.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 76b33367-a62f-424f-89c3-c25eff5d08cb

📥 Commits

Reviewing files that changed from the base of the PR and between 238ac81 and 7ea3bd9.

📒 Files selected for processing (23)
  • custom_components/plugwise/const.py
  • custom_components/plugwise/manifest.json
  • custom_components/plugwise/number.py
  • custom_components/plugwise/translations/en.json
  • custom_components/plugwise/translations/nl.json
  • custom_components/plugwise/water_heater.py
  • tests/components/plugwise/fixtures/adam_plus_anna_new/data.json
  • tests/components/plugwise/fixtures/anna_heatpump_heating/data.json
  • tests/components/plugwise/fixtures/anna_p1/data.json
  • tests/components/plugwise/fixtures/anna_v4/data.json
  • tests/components/plugwise/fixtures/anna_v4_dhw/data.json
  • tests/components/plugwise/fixtures/m_adam_cooling/data.json
  • tests/components/plugwise/fixtures/m_adam_heating/data.json
  • tests/components/plugwise/fixtures/m_adam_heating_off_schedule/data.json
  • tests/components/plugwise/fixtures/m_adam_jip/data.json
  • tests/components/plugwise/fixtures/m_anna_heatpump_cooling/data.json
  • tests/components/plugwise/snapshots/test_number.ambr
  • tests/components/plugwise/snapshots/test_select.ambr
  • tests/components/plugwise/snapshots/test_sensor.ambr
  • tests/components/plugwise/snapshots/test_water_heater.ambr
  • tests/components/plugwise/test_init.py
  • tests/components/plugwise/test_number.py
  • tests/components/plugwise/test_water_heater.py
💤 Files with no reviewable changes (2)
  • tests/components/plugwise/test_number.py
  • tests/components/plugwise/snapshots/test_sensor.ambr
✅ Files skipped from review due to trivial changes (5)
  • tests/components/plugwise/fixtures/anna_p1/data.json
  • tests/components/plugwise/fixtures/adam_plus_anna_new/data.json
  • tests/components/plugwise/snapshots/test_number.ambr
  • tests/components/plugwise/test_init.py
  • tests/components/plugwise/snapshots/test_select.ambr
🚧 Files skipped from review as they are similar to previous changes (16)
  • tests/components/plugwise/test_water_heater.py
  • custom_components/plugwise/manifest.json
  • tests/components/plugwise/fixtures/anna_v4/data.json
  • custom_components/plugwise/number.py
  • tests/components/plugwise/fixtures/m_adam_cooling/data.json
  • custom_components/plugwise/translations/nl.json
  • tests/components/plugwise/fixtures/m_anna_heatpump_cooling/data.json
  • tests/components/plugwise/fixtures/m_adam_jip/data.json
  • tests/components/plugwise/fixtures/anna_v4_dhw/data.json
  • custom_components/plugwise/translations/en.json
  • tests/components/plugwise/fixtures/m_adam_heating/data.json
  • tests/components/plugwise/fixtures/anna_heatpump_heating/data.json
  • tests/components/plugwise/fixtures/m_adam_heating_off_schedule/data.json
  • custom_components/plugwise/water_heater.py
  • custom_components/plugwise/const.py
  • tests/components/plugwise/snapshots/test_water_heater.ambr

📝 Walkthrough

Walkthrough

Replaces legacy max-temperature number entities and the single water-heater entity with separate boiler_temperature and dhw_temperature variants, updates translations and fixtures to match the new schema, and switches the Plugwise dependency to the water_heater_2 git target.

Changes

Water Heater Multi-Entity Refactor

Layer / File(s) Summary
Constants and type aliases
custom_components/plugwise/const.py
Removes max boiler and DHW temperature constants from the number section, adds water-heater constants, narrows NumberType, and introduces WaterHeaterType/WaterHeaterOptionsType.
Number entity updates
custom_components/plugwise/number.py
Removes the boiler max-temperature number entity and reads number limits and step values directly from device control data.
Water heater platform
custom_components/plugwise/water_heater.py
Adds a description-driven water-heater registry, creates one entity per supported heater variant, and updates temperature and operation-mode handling to use the variant key and options key.
Translations
custom_components/plugwise/translations/en.json, custom_components/plugwise/translations/nl.json
Removes the old number keys, updates DHW mode labels, and reshapes water-heater translations for boiler_temperature and dhw_temperature.
Dependency update
custom_components/plugwise/manifest.json
Changes the Plugwise requirement from the pinned release to the git target on the water_heater_2 branch.
Test fixtures
tests/components/plugwise/fixtures/*/data.json
Updates heater fixture JSON payloads to use boiler_temperature and dhw_temperature objects, switch DHW mode data to eco, and remove water_temperature sensor entries.
Snapshots
tests/components/plugwise/snapshots/test_*.ambr
Removes obsolete number and sensor snapshots, updates DHW select snapshots to eco, and adds separate boiler_temperature and dhw_temperature water-heater snapshots.
Test assertions
tests/components/plugwise/test_init.py, tests/components/plugwise/test_number.py, tests/components/plugwise/test_water_heater.py
Adjusts entity-count assertions, replaces the explicit max-boiler-temperature number test with snapshot validation, and retargets the water-heater service test to the DHW entity and eco mode.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

require-dev-pass

Suggested reviewers

  • CoMPaTech
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main change: continuing the water_heater platform implementation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch water_heater_2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot requested a review from CoMPaTech June 23, 2026 06:04
@coderabbitai coderabbitai Bot added enhancement New feature or request needs_upstreaming Things that are here in -beta but must be upstreamed to HA-core labels Jun 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@custom_components/plugwise/manifest.json`:
- Line 11: The plugwise dependency URL in the manifest.json contains an extra
forward slash in the git reference syntax. In the string starting with
"plugwise@git+https://github.com/plugwise/python-plugwise.git/@water_heater_2",
remove the forward slash that appears between ".git" and "`@water_heater_2`" so
the URL follows the correct PEP 508 VCS format:
git+https://github.com/plugwise/python-plugwise.git@water_heater_2.
- Around line 10-12: The git requirement URL for the plugwise package in the
requirements array contains a malformed reference syntax with an extraneous
forward slash. In the plugwise requirement string that starts with
"plugwise@git+https://github.com/plugwise/python-plugwise.git/", remove the
forward slash immediately before the @ symbol so that it reads
"plugwise@git+https://github.com/plugwise/python-plugwise.git@water_heater_2"
instead. The @ symbol must attach directly to .git without an intervening slash
for pip to correctly resolve the git branch reference.

In `@custom_components/plugwise/number.py`:
- Around line 110-120: The issue is that self.ctrl is cached once during
initialization, causing the native_value property to return stale data after
coordinator updates. Instead of caching self.ctrl as an instance variable in the
initialization block, remove that line and modify the native_value property to
read directly from the current device state each time it is called by accessing
self.device.get(description.key, {}).get("setpoint"). Keep the initialization of
_attr_native_max_value, _attr_native_min_value, and _attr_native_step since they
define static bounds, but ensure native_value always fetches the fresh setpoint
from the device payload.

In `@custom_components/plugwise/translations/nl.json`:
- Line 307: The "off" label in the Dutch translation file (nl.json) currently
has the English value "Off" instead of the proper Dutch translation. Replace the
value "Off" with the Dutch translation "Uit" for the "off" key to maintain
consistency with other Dutch state labels in the file.

In `@custom_components/plugwise/water_heater.py`:
- Around line 109-110: The OPERATION_MODE feature is being advertised for all
water heater entities regardless of whether they actually have mode options
available. For entities like boiler_temperature where options_key is None, the
OPERATION_MODE feature should not be added to _attr_supported_features. Gate the
addition of WaterHeaterEntityFeature.OPERATION_MODE by checking if the entity
has valid mode options (i.e., options_key is not None) before setting it in the
feature flags. Apply this conditional gating consistently across all water
heater entity classes to prevent invalid mode-control paths.
- Around line 105-112: Remove the caching of `self.dhw_temp` at initialization
and instead use `description.key` dynamically to access per-entity temperature
data. Replace the line that sets `self.dhw_temp = self.device.get(DHW_TEMP, {})`
with direct references to `self.device.get(description.key, {})` when reading
UPPER_BOUND and LOWER_BOUND temperature limits. Apply this same pattern change
to the other affected areas (lines 122-123, 138-140, and 152) to ensure each
entity reads its own temperature configuration key dynamically rather than
caching stale data from initialization.

In `@tests/components/plugwise/snapshots/test_water_heater.ambr`:
- Around line 8-13: The boiler water-heater snapshots in the test file are
validating DHW-derived limits and modes instead of boiler-derived values, and
they contain an inconsistent mode contract where operation_list only contains
"on" while operation_mode or state is set to "eco". Update all affected snapshot
sections (including the ones at the specified line ranges) to use boiler-derived
temperature limits and operation modes, and ensure the operation_list values are
consistent with the actual operation_mode and state values being tested so that
the snapshots accurately validate the boiler entity behavior and catch any
mapping regressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 17c1491e-eff1-49b3-8758-2e4ea2f4c9c5

📥 Commits

Reviewing files that changed from the base of the PR and between cdf60ad and 7e8bbb2.

📒 Files selected for processing (23)
  • custom_components/plugwise/const.py
  • custom_components/plugwise/manifest.json
  • custom_components/plugwise/number.py
  • custom_components/plugwise/translations/en.json
  • custom_components/plugwise/translations/nl.json
  • custom_components/plugwise/water_heater.py
  • tests/components/plugwise/fixtures/adam_plus_anna_new/data.json
  • tests/components/plugwise/fixtures/anna_heatpump_heating/data.json
  • tests/components/plugwise/fixtures/anna_p1/data.json
  • tests/components/plugwise/fixtures/anna_v4/data.json
  • tests/components/plugwise/fixtures/anna_v4_dhw/data.json
  • tests/components/plugwise/fixtures/m_adam_cooling/data.json
  • tests/components/plugwise/fixtures/m_adam_heating/data.json
  • tests/components/plugwise/fixtures/m_adam_heating_off_schedule/data.json
  • tests/components/plugwise/fixtures/m_adam_jip/data.json
  • tests/components/plugwise/fixtures/m_anna_heatpump_cooling/data.json
  • tests/components/plugwise/snapshots/test_number.ambr
  • tests/components/plugwise/snapshots/test_select.ambr
  • tests/components/plugwise/snapshots/test_sensor.ambr
  • tests/components/plugwise/snapshots/test_water_heater.ambr
  • tests/components/plugwise/test_init.py
  • tests/components/plugwise/test_number.py
  • tests/components/plugwise/test_water_heater.py
💤 Files with no reviewable changes (3)
  • tests/components/plugwise/test_number.py
  • tests/components/plugwise/snapshots/test_number.ambr
  • tests/components/plugwise/snapshots/test_sensor.ambr

Comment thread custom_components/plugwise/manifest.json
Comment thread custom_components/plugwise/manifest.json Outdated
Comment thread custom_components/plugwise/number.py Outdated
Comment thread custom_components/plugwise/translations/nl.json Outdated
Comment thread custom_components/plugwise/water_heater.py Outdated
Comment thread custom_components/plugwise/water_heater.py Outdated
Comment thread tests/components/plugwise/snapshots/test_water_heater.ambr Outdated
@coderabbitai coderabbitai Bot added the require-dev-pass Require actions to pass against HA dev-branch (and silently fail on HA master-branch) label Jun 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
custom_components/plugwise/translations/nl.json (1)

100-106: 📐 Maintainability & Code Quality | 🔵 Trivial

Verify completeness of select_dhw_mode translations.

The translation files for select_dhw_mode currently define only comfort and eco. As the available options are populated dynamically from the device, ensure that all other potential DHW modes supported by the firmware (e.g., anti_freeze, boost, off) are included in the translation keys to prevent untranslated strings in the UI.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@custom_components/plugwise/translations/nl.json` around lines 100 - 106, The
select_dhw_mode translation is incomplete: only comfort and eco are defined in
the select state map. Update the translation entries for select_dhw_mode in the
nl.json select section to include every DHW mode the device can expose, such as
anti_freeze, boost, and off, so the UI has localized labels for all dynamically
populated options.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@custom_components/plugwise/translations/nl.json`:
- Around line 100-106: The select_dhw_mode translation is incomplete: only
comfort and eco are defined in the select state map. Update the translation
entries for select_dhw_mode in the nl.json select section to include every DHW
mode the device can expose, such as anti_freeze, boost, and off, so the UI has
localized labels for all dynamically populated options.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 34a1eae3-127e-4e4f-bbe9-c98d1edf4867

📥 Commits

Reviewing files that changed from the base of the PR and between 7e8bbb2 and 2aff0ac.

📒 Files selected for processing (5)
  • custom_components/plugwise/manifest.json
  • custom_components/plugwise/number.py
  • custom_components/plugwise/translations/en.json
  • custom_components/plugwise/translations/nl.json
  • custom_components/plugwise/water_heater.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • custom_components/plugwise/number.py
  • custom_components/plugwise/manifest.json
  • custom_components/plugwise/translations/en.json

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while testing for Development HA-core:

⚠️ Warning: Incompatible while testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while testing for Development HA-core:

Error: Incompatible while testing against dev HA-core and required to pass.
✔️ Success: No problem with testing against released HA-core.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while testing for Development HA-core:

Error: Incompatible while testing against dev HA-core and required to pass.
✔️ Success: No problem with testing against released HA-core.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while testing for Development HA-core:

Error: Incompatible while testing against dev HA-core and required to pass.
✔️ Success: No problem with testing against released HA-core.

@bouwew bouwew force-pushed the water_heater_2 branch 3 times, most recently from 7e333a8 to cd937d8 Compare June 25, 2026 18:17

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while testing for Development HA-core:

Error: Incompatible while testing against dev HA-core and required to pass.
✔️ Success: No problem with testing against released HA-core.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while testing for Development HA-core:

Error: Incompatible while testing against dev HA-core and required to pass.
✔️ Success: No problem with testing against released HA-core.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while testing for Development HA-core:

Error: Incompatible while testing against dev HA-core and required to pass.
✔️ Success: No problem with testing against released HA-core.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning while testing for RELEASED HA-core:

✔️ Success: No problem with testing against dev HA-core.
✔️ Success: No problem with testing against released HA-core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request needs_upstreaming Things that are here in -beta but must be upstreamed to HA-core require-dev-pass Require actions to pass against HA dev-branch (and silently fail on HA master-branch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant